package com.fly.entity.vo;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.ai.chat.messages.Message;

@NoArgsConstructor
@Data
public class MessageVo {
    private String role;
    private String content;

    public MessageVo(Message message) {
        // 根据消息类型设置角色
        switch (message.getMessageType()) {
            case USER:
                this.role = "user";
                break;
            case ASSISTANT:
                this.role = "assistant";
                break;
        }
        // 设置消息内容
        this.content = message.getText();

    }
}
